//home页面小仓库
import { reqCategoryList, reqGetBannerList, reqGetFloorList} from "@/api";
const state = {
    categoryList: [],
    getBannerList: [],
    floorList:[]
};
const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList;
    },
    GETBANNERLIST(state, getBannerList) {
        state.getBannerList = getBannerList
    },
    GETFLOORLIST(state,floorList){
        state.floorList=floorList
    }
};
const actions = {
    //通过api里接口函数调用获取数据
    async categoryList({ commit }) {
        let result = await reqCategoryList();
        
        if (result.code == 200) {
            commit('CATEGORYLIST', result.data)
        }
    },
    async getBannerList({ commit }) {
        let results = await reqGetBannerList()
        if (results.code == 200) {
            commit('GETBANNERLIST', results.data)
        }
    },
    async getFloorList({commit}){
        let result =await reqGetFloorList();
        if(result.code==200){
            commit('GETFLOORLIST',result.data)
        }
    }
};
const getters = {};

export default {
    state,
    mutations,
    actions,
    getters,
}